<template>
	<view class="wanlpage-advert-yuanbao">
		<view class="yuanbao" @click="onLink('/pages/product/bdGoodsList','','auth')">
			<image src="@/static/images/index/jifen.png" mode=""></image>
			<!-- <image :src="'https://d-shenhuashop.bigchun.com/h5test/yuanbao/zhuanqun.png'"></image> -->
		</view>
		<view class="yuanbao2">
			<!-- /pages/apps/jinyuanbao/choujiang/choujiangHistory -->
			<view class="yuanbao_img" @click="onLink('/pages/product/list','','')">
				<image src="@/static/images/index/shangpin.png" mode=""></image>
				<!-- <image :src="'https://d-shenhuashop.bigchun.com/h5test/yuanbao/duihuan.png'"></image> -->
			</view>
			<view class="yuanbao_img" style="margin-top: 10rpx"
				@click="onLink('/pages/community?index=0','tabbar','auth')">
				<image src="@/static/images/index/haoyou.png" mode=""></image>
				<!-- <image :src="'https://d-shenhuashop.bigchun.com/h5test/yuanbao/fujin.png'"></image> -->
			</view>
		</view>
		<view class="yuanbao2">
			<!-- /pages/apps/jinyuanbao/chongzhi/chongzhi -->
			<view class="yuanbao_img" @click="onLink('/pages/newPage/otc?id=1','','auth')">
				<image src="@/static/images/index/yuanbao.png" mode=""></image>
				<!-- <image :src="'https://d-shenhuashop.bigchun.com/h5test/yuanbao/chongzhi.png'"></image> -->
			</view>
			<view class="yuanbao_img" style="margin-top: 10rpx"
				@click="onLink('/pages/apps/jinyuanbao/choujiang/choujiang','','auth')">
				<image :src="'https://d-shenhuashop.bigchun.com/h5test/yuanbao/choujiang.png'"></image>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		mapState,
	} from "vuex";
	export default {
		name: "WanlPageYuanbao",
		props: {
			pageData: {
				type: Object,
				default: function() {
					return {
						name: "积分组件",
						type: "image",
						params: [],
						style: [],
						data: [],
					};
				},
			},
		},
		computed: {
			...mapState(["user"]),
		},
		methods: {
			onLink(url, type, auth) {
				if (url == '') {
					return uni.showToast({
						icon: 'none',
						title: '功能开发中,敬请期待'
					})
				}
				let user = uni.getStorageSync("wanlshop:user")
				if (auth == 'auth' && !user) {
					return uni.showToast({
						icon: 'none',
						title: '未登录,请先登录'
					})
				}
				if (type == 'tabbar') {
					uni.reLaunch({
						url: url
					})
				} else {

					this.$wanlshop.on(url);
				}
			},
		},
	};
</script>
<style lang="scss">
	.wanlpage-advert-yuanbao {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 92%;
		height: 340rpx;
		margin: 32rpx;

		.yuanbao {
			width: 36%;
			height: 100%;

			image {
				width: 100% !important;
				height: 100%;
			}
		}

		.yuanbao2 {
			width: 30%;
			height: 100%;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			.yuanbao_img {
				width: 100%;
				height: 48%;

				image {
					width: 100% !important;
					height: 100%;
				}
			}
		}
	}
</style>